var bodyParser = require('body-parser')
var cors = require("cors");
const express = require('express')
//token 缓存
let tokens = {}
const app = express()
const port = 3000
// const https = require('https');
// let SQLhelper = require('./SQLhelper');
// const {JSON}= require('mysql/lib/protocol/constants/types');
// SQLhelper(`select * from  member`).then(res => {
//     console.log("i am mysql", res);
// })

app.use(express.static('www'))
app.use(bodyParser.json({
    limit: '100mb'
}));
app.use(cors())
// 设置跨域访问
// app.all('/login',function(req,res,next) {
//     res.header("Access-Control-Allow-Origin","/login");//允许的域名
//     res.header('Access-Control-Allow-Methods','PUT,GET,POST,DELETE,OPTIONS');//允许的请求方式
//     res.header("Access-Control-Allow-Headers","X-Requested-With");//允许的header
//     res.header('Access-Control-Allow-Headers','Content-Type');
//     next();
//   });
// const wxRouter = require('./wx')
// wxRouter(app)

const adminRouter = require('./admin')
adminRouter(app)

app.listen(port, () => {
    console.log(`Example app Listening on port ${port}`);
})